package com.zzxy.po;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;

import javax.security.auth.Destroyable;

public class   User implements BeanNameAware ,  InitializingBean, DisposableBean {
    private String username;
    private String password;
    private String sex;

    public User() {
        System.out.println("1. init bean ...");
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", sex='" + sex + '\'' +
                '}';
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        System.out.println("2. set properties ...");
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public void setBeanName(String s) {
        System.out.println("3.set bean name" +s);
    }

    // @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("4.set bean factory ...");
    }


        }
    }
    /**
     * @throws Exception
     */
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("6.after properties set ...");
    }
public void myInt(){
    System.out.println("7.my init method ...");
}

    /**
     * @throws Exception
     */
    @Override
    public void destroy() throws Exception {
        System.out.println("9.destroy ... ");

    }
    public void myDestroy() {
    System.out.println("10.my destory method ... ");
    }
}
